package com.msb.apipassenger.controller;

import com.msb.apipassenger.service.TokenService;
import com.msb.commons.response.ResponseResult;
import com.msb.commons.response.TokenResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: chshh
 * @version: 1.0
 */
@RestController
public class TokenController {
    @Autowired
    private TokenService tokenService;

    @PostMapping("/token-refresh")
    public ResponseResult refreshToken(@RequestBody TokenResponse tokenResponse){
        String refreshToken = tokenResponse.getRefreshToken();
        return tokenService.refreshToken(refreshToken);
    }
}
